Getting Started
VPNWholesaler.com Custom In-App SDK is intended for Development Teams that want to fully customize their VPN apps based their requirements.
Android
Minimum OS version supported: Android 6.0 API 23
Recommended Development tool: Android Studio
Follow the steps below to add the SDK library to your project:
- Create new project or open existing one in Android Studio
- Download the library from the Downloads section
- Unpack downloaded archive to the libs subfolder of your application
- Switch to project files view in the project explorer
- Add SDK to libs folder
- Add the following lines to your application build.gradle:
implementation fileTree(include: ['vpnsdk-release-default.aar'], dir: 'libs')
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.2.1'
implementation 'com.squareup.okhttp3:okhttp-dnsoverhttps:5.2.1'
implementation 'androidx.security:security-crypto:1.1.0'
implementation 'com.google.code.gson:gson:2.13.1'
- Syncronize project with gradle files
- Add
import com.vpnwholesaler.vpnsdk.VPNSDK;to the main activity source file - Initialize the SDK in Activity OnCreate handler:
VPNSDK.InitOVSCore(new VPNSDK.OVSNotifyCB()
{
@Override
public void onNotify(String s) {
}
}, this);
- If you target SDK 31+ add the following code to application section of AndroidManifest:
<service
android:name="com.wireguard.android.backend.GoBackend$VpnService"
android:exported="false"
android:permission="android.permission.BIND_VPN_SERVICE">
<intent-filter>
<action android:name="android.net.VpnService" />
</intent-filter>
</service>
- Add the following permissions to AndroidManifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
For android 14 add this line:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SYSTEM_EXEMPTED" />
-
Create notification icon using Android Studio New Image Asset Wizard
-
Add the following code to AndroidManifest under application section:
<meta-data
tools:replace="android:value"
android:name="VPN_NOTIFICATION_ICON"
android:value="ic_stat_name" />
<meta-data
tools:replace="android:value"
android:name="VPN_PENDING_INTENT"
android:value="android.intent.action.MAIN" />
<meta-data
tools:replace="android:value"
android:name="VPN_PENDING_INTENT_ACTIVITY"
android:value=".MainActivity" />
Where:
VPN_NOTIFICATION_ICON is name of icon created at previous step.
VPN_PENDING_INTENT_ACTIVITY: Name of activity which is supposed to be open when user clicks on notification.
VPN_PENDING_INTENT: Intent which is supposed to be invoked when user clicks on notification.
- Add the following to the application build.gradle file into the android section:
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}